package me.send.business.service.service;

import java.util.HashMap;
import java.util.Map;

import me.send.business.base.ErrorEntity;
import me.send.business.service.BaseService;
import me.send.business.service.mapper.CollectionuserMapper;
import me.send.framework.util.HelperUtil;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CollectionuserService extends BaseService{
	
	@Autowired
	private CollectionuserMapper collectionuserMapper;
	
	// 测试缓存
	public ErrorEntity ocs_object() {
//		OCSHelper.OCSObjectTemp();
		return error_1000();
	}
	
	public ErrorEntity delete_userid_popuserid(Integer userid,Integer popuserid,String devicenumber){
		ErrorEntity entity = error_1001();
		if (isDevicenumber(devicenumber)) {
			Map<String, Object> parameter = new HashMap<String, Object>();
			parameter.put("userid", userid);
			parameter.put("popuserid", popuserid);
			collectionuserMapper.delete_collectionuser_userid_popuserid(parameter);
			entity = error_1000();
		}else {
			entity = error_1002();
		}
		return entity;
	}
	
	// 收藏经纪人 2015年7月2日17:50:56
	public ErrorEntity insert_collectionuser(String devicenumber,Integer userid,Integer popuserid) {
		ErrorEntity entity = error_1001();
		if (isDevicenumber(devicenumber)) {
			Map<String, Object> parameter = new HashMap<String, Object>();
			parameter.put("userid", userid);
			parameter.put("popuserid", popuserid);
			parameter.put("createtime", HelperUtil.getCurrentDate());
			collectionuserMapper.insert_collectionuser(parameter);
			entity = error_1000();
		}else {
			entity = error_1002();
		}
		return entity;
	}
}
